home *** CD-ROM | disk | FTP | other *** search
- global gMaster, gMasterDocPath, gMasterFolder
-
- on CaptionCode vPathInfo
- fileObj2 = new(xtra("fileIO"))
- vTemp = gMasterDocPath & "Captions.txt"
- vTemp2 = gMasterDocPath & "Captions.txt"
- vOK = 0
- if baFileExists(vTemp) = 1 then
- vOK = 1
- else
- vOK = 0
- end if
- if vOK = 1 then
- vMasterPath = gMasterFolder
- else
- if baFileExists(vTemp2) = 1 then
- vOK = 2
- vMasterPath = gMasterFolder
- else
- vOK = 0
- vMasterPath = gMasterFolder
- end if
- end if
- case vOK of
- 0:
- saveText2(vTemp2, gMaster.pCaption1, gMaster.pCaption2, gMaster.pCaption3)
- 1, 2:
- openfile(fileObj2, vTemp2, 0)
- if status(fileObj2) <> 0 then
- err = error(fileObj2, status(fileObj2))
- alert("Error:" && err)
- return EMPTY
- end if
- vText = readFile(fileObj2)
- closeFile(fileObj2)
- saveText1(vText, vTemp2, gMaster.pCaption3)
- end case
- end
-
- on saveText1 text, vFileName, vCaption3
- Ok = baCreateFolder(gMasterDocPath)
- vNewname = vFileName
- fileObj = new(xtra("FileIO"))
- if the platform contains "mac" then
- setFilterMask(fileObj, "TEXT")
- else
- setFilterMask(fileObj, "Text Files,*.txt,All Files,*.*")
- end if
- if vFileName = EMPTY then
- return 0
- end if
- openfile(fileObj, vNewname, 2)
- delete(fileObj)
- createFile(fileObj, vNewname)
- openfile(fileObj, vNewname, 2)
- if status(fileObj) <> 0 then
- err = error(fileObj, status(fileObj))
- alert("Error:" && err)
- return 0
- end if
- vPhotoCaptions = CollectPhotoCaptions()
- vLines = "==================================================="
- if the platform contains "Mac" then
- vAdditionText = text & RETURN & RETURN & RETURN & RETURN & vLines & RETURN & RETURN & vPhotoCaptions & RETURN & RETURN & vCaption3
- else
- CRLF = RETURN & numToChar(10)
- vAdditionText = text & CRLF & CRLF & CRLF & CRLF & vLines & CRLF & CRLF & vPhotoCaptions & CRLF & CRLF & vCaption3
- end if
- writeString(fileObj, vAdditionText)
- if the platform contains "Mac" then
- setFinderInfo(fileObj, "TEXT ttxt")
- end if
- closeFile(fileObj)
- return 1
- end
-
- on saveText2 vFileName, vCaption1, vCaption2, vCaption3
- Ok = baCreateFolder(gMasterDocPath)
- vNewname = vFileName
- fileObj = new(xtra("FileIO"))
- if the platform contains "mac" then
- setFilterMask(fileObj, "TEXT")
- else
- setFilterMask(fileObj, "Text Files,*.txt,All Files,*.*")
- end if
- if vFileName = EMPTY then
- return 0
- end if
- openfile(fileObj, vNewname, 2)
- delete(fileObj)
- createFile(fileObj, vNewname)
- openfile(fileObj, vNewname, 2)
- if status(fileObj) <> 0 then
- err = error(fileObj, status(fileObj))
- alert("Error:" && err)
- return 0
- end if
- vPhotoCaptions = CollectPhotoCaptions()
- if the platform contains "Mac" then
- vText = vCaption1 & RETURN & RETURN & vCaption2 & RETURN & vPhotoCaptions & RETURN & RETURN & vCaption3
- else
- CRLF = RETURN & numToChar(10)
- vText = vCaption1 & CRLF & CRLF & vCaption2 & CRLF & vPhotoCaptions & CRLF & CRLF & vCaption3
- end if
- writeString(fileObj, vText)
- if the platform contains "Mac" then
- setFinderInfo(fileObj, "TEXT ttxt")
- end if
- closeFile(fileObj)
- return 1
- end
-
- on CollectPhotoCaptions
- vTempText = EMPTY
- repeat with y = 1 to gMaster.pPhotoList.count
- if gMaster.pPhotoList[y].pSelected = "yes" then
- if gMaster.pLanguageMode = "english" then
- vlargeName = gMaster.pPhotoList[y].pLargeName & " - "
- if the platform contains "Mac" then
- vTempText = vTempText & RETURN & RETURN & vlargeName & gMaster.pPhotoList[y].pEnglishCaption
- else
- CRLF = RETURN & numToChar(10)
- vTempText = vTempText & CRLF & CRLF & vlargeName & gMaster.pPhotoList[y].pEnglishCaption
- end if
- next repeat
- end if
- vlargeName = gMaster.pPhotoList[y].pLargeName & " - "
- if the platform contains "Mac" then
- vTempText = vTempText & RETURN & RETURN & vlargeName & gMaster.pPhotoList[y].pSpanishCaption
- next repeat
- end if
- CRLF = RETURN & numToChar(10)
- vTempText = vTempText & CRLF & CRLF & vlargeName & gMaster.pPhotoList[y].pSpanishCaption
- end if
- end repeat
- return vTempText
- end
-